<template>
  <div class="wrap">
    <!-- 上面是个人信息 -->
    <div class="top">
      <div class="df p30">
        <div class="avator"><img v-if="info.avator" :src="uploadUrl + 'resource/' + info.avator + '?imageView/2/w/150/h/150'" alt=""></div>
        <div class="flex1 fs28">
          <div class="df jsb fs30 mb15"><div>{{info.name}} <span class="fs24 colorBlue" style="margin-left:10rpx;">{{info.org_name}}</span></div>  <van-icon name="edit" @click="edit(info.id)"></van-icon></div>
          <div class="fs28">
             性别：<dic-label typeCode="sex" v-model="info.sex"></dic-label>  &nbsp;&nbsp;&nbsp;出生日期：{{info.birthday}}
          </div>
        </div>
      </div>
      <div class="p30">
          <div class="df fs28 jsb mb15 item">
            <span>年龄： {{info.age}}</span> <span>身份证号：{{info.id_card}}</span>
          </div>
          <div class="df fs28 jsb mb15 item">
            <span>健康状况： <dic-label typeCode="physical_state" v-model="info.health"></dic-label></span> <span>电话： {{info.tel}}</span>
          </div>
          <div class="df fs28 jsb mb15 item">
            <span>血型： <dic-label typeCode="blood" v-model="info.blood"></dic-label></span> <span v-if="info.rh_blood">Rh血型： <dic-label typeCode="rh_type" v-model="info.rh_blood"></dic-label></span>
          </div>
          <div class="df fs28 jsb mb15 item">
            <span>第一联系人：{{info.first_contact}}</span> <span>电话： {{info.first_tel}}</span>
          </div>
          <div class="df fs28 jsb mb15 item">
            <span>设计师：{{info.second_contact}}</span> <span>电话： {{info.second_tel}}</span>
          </div>
          <div class="df fs28 item" v-if="info.remark">
            <span>备注：{{info.remark}}</span>
          </div>
          <!-- <div class="bot_p_i df fs28 item jsb">
            <div class="fs28">体检信息</div>
            <div class="fs24 mainColor view_btn" @click="linkTj()">查看</div>
          </div>
          <div class="bot_p_i df fs28 item jsb">
            <div class="fs28">抽脂信息</div>
            <div class="fs24 mainColor view_btn" @click="linkCz()">查看</div>
          </div> -->
      </div>
    </div>
    <div class="bot_part df jsb">
      <div class="bot_p_i tc" @click="linkTj()">
        <div class="fs28">体检信息</div>
        <!-- <div class="fs26 mainColor">查看</div> -->
      </div>
      <div class="bot_p_i tc" @click="linkCz()">
        <div class="fs28">抽脂信息</div>
        <!-- <div class="fs26 mainColor">查看</div> -->
      </div>
    </div>
    <!-- 下面是个人体检列表 -->
    <!-- <div class="bot fs30">
      <div class="item title fs30 df jsb">体检信息列表 <span class="colorBlue fs30" @click="editReports(info.id)">添加</span></div>
      <div class="item df jsb" v-for="(item, index) in reports" :key='index' @click="editReports(info.id, item.id)">
        <div>{{item.date_time}} <span :class="item.state === '1'? 'statusok':'statusno' "><dic-label typeCode="medical_state" v-model="item.state"></dic-label></span></div>
        <div><van-icon name="edit"></van-icon></div>
      </div>
    </div> -->
  </div>
</template>

<script>
import { getCustomerDetail } from '@/api'
import setting from '@/setting'
import dicLabel from '@/components/dic_label'
export default {
  components: {
    dicLabel
  },

  data () {
    return {
      uploadUrl: '',
      info: {}
    }
  },
  methods: {
    linkTj () {
      const url = '../tj_record/main?id=' + this.info.id
      wx.navigateTo({ url })
    },
    linkCz () {
      const url = '../cz_record/main?id=' + this.info.id
      wx.navigateTo({ url })
    },
    async initData () {
      this.uploadUrl = setting.uploadUrl
      const data = await getCustomerDetail(this.$mp.query.id)
      this.info = data.data
    },
    edit (id) {
      const url = '../add_customer/main?text=edit&id=' + id
      wx.navigateTo({ url })
    }
  },
  onShow () {
    this.initData()
  }
}
</script>

<style scoped>
.avator{width: 100rpx;height: 100rpx;margin-right: 20rpx;}
.avator img{width: 100%;height: 100%;border-radius: 50%;}
.wrap{background: #eee;height: 100vh;overflow: scroll}
.bot{background: #fff}
.item{border-bottom: 1px solid #eee;padding: 20rpx}
.top{border-bottom: 20rpx solid #eee;background: #fff}
.p30{padding: 30rpx;}
.statusok{color:#2f74ff;margin-left: 20rpx;}
.statusno{color: red;margin-left: 20rpx;}
.bot_part{padding: 30rpx;}
.bot_p_i{background: #2f74ff;color: #fff;width: 45%;padding: 20rpx 0;border-radius: 20rpx;}
</style>
